from ai.views.model import ModelsView
from ai.views.project import ProjectsView
from django.urls import path
from rest_framework.routers import SimpleRouter

from ai.views.service import ServicesView

router = SimpleRouter()

# 注册视图集
router.register("models", ModelsView, basename="models")
router.register("projects", ProjectsView, basename="projects")
router.register("services", ServicesView, basename="services")

urlpatterns = [
    # 上传测试图片
    path('models/file/', ModelsView.as_view({'post': 'uploadImg', })),
    # 移动测试图片
    path('models/move/', ModelsView.as_view({'post': 'moveImg', })),
    # 获取评估报告
    path('models/report/', ModelsView.as_view({'get': 'report', })),
    # 模型测试
    path('models/predict/', ModelsView.as_view({'get': 'predict', })),
    # 获取训练状态
    path('models/status/', ModelsView.as_view({'get': 'getStatus', })),
    # 终止训练
    path('models/stop/', ModelsView.as_view({'get': 'stopTrain', })),
    # 上传json文件
    path('datasets/uploadJson/', ModelsView.as_view({'post': 'uploadJson', })),
    # 处理数据集
    path('datasets/handle/', ModelsView.as_view({'get': 'handleDataset', })),
]

urlpatterns += router.urls
